package com.ruoyi.combo.mapper;

import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.combo.domain.Combo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 充值套餐Mapper接口
 * 
 * @author ruoyi
 * @date 2025-01-09
 */
public interface ComboMapper 
{
    /**
     * 查询充值套餐
     *
     * @param comboId 充值套餐主键
     * @return 充值套餐
     */
    public Combo selectComboByComboId(String comboId);

    /**
     * 查询充值套餐列表
     *
     * @param combo 充值套餐
     * @return 充值套餐集合
     */
    public List<Combo> selectComboList(Combo combo);

    /**
     * 新增充值套餐
     *
     * @param combo 充值套餐
     * @return 结果
     */
    public int insertCombo(Combo combo);

    /**
     * 修改充值套餐
     *
     * @param combo 充值套餐
     * @return 结果
     */
    public int updateCombo(Combo combo);

    /**
     * 删除充值套餐
     *
     * @param comboId 充值套餐主键
     * @return 结果
     */
    public int deleteComboByComboId(String comboId);

    /**
     * 批量删除充值套餐
     *
     * @param comboIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteComboByComboIds(String[] comboIds);

    /**
     * 插入用户充值记录
     * @param userId 用户ID
     * @param comboId 充值套餐ID
     */
    @Insert("insert into recharge_records(user_id, combo_id) values (#{userId}, #{comboId})")
    void insertRechargeRecords(@Param("userId") Long userId, @Param("comboId") Integer comboId);

    /**
     * 获取赠送金额
     *
     * @param comboMoney
     * @return
     */
    @Select("select bonus_money from combo where combo_money=#{comboMoney}")
    BigDecimal getBonusMoneyByComboMoney(@Param("comboMoney") BigDecimal comboMoney);
}
